﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGePolyline3d : OdGeSplineEnt3d
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGePolyline3d(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGePolyline3d_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGePolyline3d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGePolyline3d()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGePolyline3d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGePolyline3d() : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePolyline3d(OdGePolyline3d source) : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_1(OdGePolyline3d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePolyline3d(OdGePoint3dArray points) : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_2(OdGePoint3dArray.getCPtr(points)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePolyline3d(OdGeKnotVector knots, OdGePoint3dArray controlPoints) : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_3(OdGeKnotVector.getCPtr(knots), OdGePoint3dArray.getCPtr(controlPoints)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePolyline3d(OdGeCurve3d crv, double approxEps) : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_4(OdGeCurve3d.getCPtr(crv), approxEps), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePolyline3d(int numPoints, OdGePoint3d pPoints) : this(GlobalsPINVOKE.new_OdGePolyline3d__SWIG_5(numPoints, OdGePoint3d.getCPtr(pPoints)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public int numFitPoints()
		{
			int result = GlobalsPINVOKE.OdGePolyline3d_numFitPoints(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d fitPointAt(int fitPointIndex)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGePolyline3d_fitPointAt(this.swigCPtr, fitPointIndex), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSplineEnt3d setFitPointAt(int index, OdGePoint3d point)
		{
			OdGeSplineEnt3d result = new OdGeSplineEnt3d(GlobalsPINVOKE.OdGePolyline3d_setFitPointAt(this.swigCPtr, index, OdGePoint3d.getCPtr(point)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePolyline3d Assign(OdGePolyline3d polyline)
		{
			OdGePolyline3d result = new OdGePolyline3d(GlobalsPINVOKE.OdGePolyline3d_Assign(this.swigCPtr, OdGePolyline3d.getCPtr(polyline)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d evalPointSeg(double param, out int numSeg)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGePolyline3d_evalPointSeg(this.swigCPtr, param, out numSeg), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
